{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np \n",
    "from matplotlib import pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "from datetime import datetime, timedelta"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "dict_dtypes = {}\n",
    "dict_dtypes['temp'] = {'Tmax(C)':float, 'Tmin(C)':float, 'Tmean(C)':float, 'RHmean(%)':float}\n",
    "dict_dtypes['sun'] = dtype={'Amount(Hrs)':float}\n",
    "dict_dtypes['rain'] = dtype={'Amount(mm)':float}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "def make_index(df): \n",
    "    dfc = df.copy()\n",
    "    dates = pd.to_datetime(dfc.loc[:,'Date(NZST)'], dayfirst=True)\n",
    "    hours = dfc.loc[:,'Time(NZST)']\n",
    "    hours = [int(h.split(':')[0]) for h in hours]\n",
    "    datetimes = [d[0] + timedelta(hours = d[1]) for d in zip(dates, hours)]\n",
    "    dfc.index = datetimes\n",
    "    datetimes = pd.date_range(start=dfc.index[0], end=dfc.index[-1], freq='1H')\n",
    "    dfc = dfc.reindex(datetimes)\n",
    "    return dfc"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "def select_morning(df, resample=True): \n",
    "    df_day = df.between_time('05:00', '9:00')\n",
    "    if resample: \n",
    "        df_day = df_day.resample('1D').mean() \n",
    "    return df_day"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "def select_day(df, resample=True): \n",
    "    df_day = df.between_time('06:00', '19:00')\n",
    "    if resample: \n",
    "        df_day = df_day.resample('1D').mean() \n",
    "    return df_day"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "def select_commute(df): \n",
    "    df_morning = df.between_time('06:00', '09:00')\n",
    "    df_eve = df.between_time('16:00', '18:00')\n",
    "    df_morning = df_morning.resample('1D').mean() \n",
    "    df_eve = df_eve.resample('1D').mean()\n",
    "    df_commute = (df_morning + df_eve) / 2 \n",
    "    return df_commute"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [],
   "source": [
    "temp = pd.read_csv('../data/weather/hourly/mangere hourly temp.csv', dtype=dict_dtypes['temp'], na_values=['-'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['Station', 'Date(NZST)', 'Time(NZST)', 'Tmax(C)', 'Period(Hrs)',\n",
       "       'Tmin(C)', 'Period(Hrs).1', 'Tgmin(C)', 'Period(Hrs).2', 'Tmean(C)',\n",
       "       'RHmean(%)', 'Period(Hrs).3', 'Freq'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "temp.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "temp = temp.drop(['Period(Hrs)', 'Period(Hrs).1', 'Period(Hrs).2', 'Period(Hrs).3','Freq'], axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Station</th>\n",
       "      <th>Date(NZST)</th>\n",
       "      <th>Time(NZST)</th>\n",
       "      <th>Tmax(C)</th>\n",
       "      <th>Tmin(C)</th>\n",
       "      <th>Tgmin(C)</th>\n",
       "      <th>Tmean(C)</th>\n",
       "      <th>RHmean(%)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>0:00</td>\n",
       "      <td>20.2</td>\n",
       "      <td>19.8</td>\n",
       "      <td>19.6</td>\n",
       "      <td>20.2</td>\n",
       "      <td>92.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>1:00</td>\n",
       "      <td>20.0</td>\n",
       "      <td>19.7</td>\n",
       "      <td>19.5</td>\n",
       "      <td>19.8</td>\n",
       "      <td>94.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>2:00</td>\n",
       "      <td>20.1</td>\n",
       "      <td>19.7</td>\n",
       "      <td>19.5</td>\n",
       "      <td>19.9</td>\n",
       "      <td>94.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>3:00</td>\n",
       "      <td>19.8</td>\n",
       "      <td>19.6</td>\n",
       "      <td>19.3</td>\n",
       "      <td>19.8</td>\n",
       "      <td>94.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>4:00</td>\n",
       "      <td>19.8</td>\n",
       "      <td>19.4</td>\n",
       "      <td>19.2</td>\n",
       "      <td>19.6</td>\n",
       "      <td>93.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 Station Date(NZST) Time(NZST)  Tmax(C)  Tmin(C)  Tgmin(C)  \\\n",
       "0  Auckland, Mangere Ews  1/01/2012       0:00     20.2     19.8      19.6   \n",
       "1  Auckland, Mangere Ews  1/01/2012       1:00     20.0     19.7      19.5   \n",
       "2  Auckland, Mangere Ews  1/01/2012       2:00     20.1     19.7      19.5   \n",
       "3  Auckland, Mangere Ews  1/01/2012       3:00     19.8     19.6      19.3   \n",
       "4  Auckland, Mangere Ews  1/01/2012       4:00     19.8     19.4      19.2   \n",
       "\n",
       "   Tmean(C)  RHmean(%)  \n",
       "0      20.2       92.0  \n",
       "1      19.8       94.0  \n",
       "2      19.9       94.0  \n",
       "3      19.8       94.0  \n",
       "4      19.6       93.0  "
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "temp.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "temp = make_index(temp)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Station</th>\n",
       "      <th>Date(NZST)</th>\n",
       "      <th>Time(NZST)</th>\n",
       "      <th>Tmax(C)</th>\n",
       "      <th>Tmin(C)</th>\n",
       "      <th>Tgmin(C)</th>\n",
       "      <th>Tmean(C)</th>\n",
       "      <th>RHmean(%)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2012-01-01 00:00:00</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>0:00</td>\n",
       "      <td>20.2</td>\n",
       "      <td>19.8</td>\n",
       "      <td>19.6</td>\n",
       "      <td>20.2</td>\n",
       "      <td>92.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 01:00:00</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>1:00</td>\n",
       "      <td>20.0</td>\n",
       "      <td>19.7</td>\n",
       "      <td>19.5</td>\n",
       "      <td>19.8</td>\n",
       "      <td>94.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 02:00:00</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>2:00</td>\n",
       "      <td>20.1</td>\n",
       "      <td>19.7</td>\n",
       "      <td>19.5</td>\n",
       "      <td>19.9</td>\n",
       "      <td>94.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 03:00:00</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>3:00</td>\n",
       "      <td>19.8</td>\n",
       "      <td>19.6</td>\n",
       "      <td>19.3</td>\n",
       "      <td>19.8</td>\n",
       "      <td>94.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 04:00:00</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>4:00</td>\n",
       "      <td>19.8</td>\n",
       "      <td>19.4</td>\n",
       "      <td>19.2</td>\n",
       "      <td>19.6</td>\n",
       "      <td>93.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                   Station Date(NZST) Time(NZST)  Tmax(C)  \\\n",
       "2012-01-01 00:00:00  Auckland, Mangere Ews  1/01/2012       0:00     20.2   \n",
       "2012-01-01 01:00:00  Auckland, Mangere Ews  1/01/2012       1:00     20.0   \n",
       "2012-01-01 02:00:00  Auckland, Mangere Ews  1/01/2012       2:00     20.1   \n",
       "2012-01-01 03:00:00  Auckland, Mangere Ews  1/01/2012       3:00     19.8   \n",
       "2012-01-01 04:00:00  Auckland, Mangere Ews  1/01/2012       4:00     19.8   \n",
       "\n",
       "                     Tmin(C)  Tgmin(C)  Tmean(C)  RHmean(%)  \n",
       "2012-01-01 00:00:00     19.8      19.6      20.2       92.0  \n",
       "2012-01-01 01:00:00     19.7      19.5      19.8       94.0  \n",
       "2012-01-01 02:00:00     19.7      19.5      19.9       94.0  \n",
       "2012-01-01 03:00:00     19.6      19.3      19.8       94.0  \n",
       "2012-01-01 04:00:00     19.4      19.2      19.6       93.0  "
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "temp.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "temp_hourly_day = select_day(temp, resample=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "temp_hourly_day.to_csv('../data/weather/hourly/temp_hourly_daytime.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "sun = pd.read_csv('../data/weather/hourly/mangere hourly sun.csv', dtype=dict_dtypes['sun'], na_values=['-'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Station</th>\n",
       "      <th>Date(NZST)</th>\n",
       "      <th>Time(NZST)</th>\n",
       "      <th>Amount(Hrs)</th>\n",
       "      <th>Period(Hrs)</th>\n",
       "      <th>Freq</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>0:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>H</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>1:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>H</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>2:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>H</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>3:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>H</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>4:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>H</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 Station Date(NZST) Time(NZST)  Amount(Hrs)  Period(Hrs) Freq\n",
       "0  Auckland, Mangere Ews  1/01/2012       0:00          0.0            1    H\n",
       "1  Auckland, Mangere Ews  1/01/2012       1:00          0.0            1    H\n",
       "2  Auckland, Mangere Ews  1/01/2012       2:00          0.0            1    H\n",
       "3  Auckland, Mangere Ews  1/01/2012       3:00          0.0            1    H\n",
       "4  Auckland, Mangere Ews  1/01/2012       4:00          0.0            1    H"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sun.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "sun = sun.drop(['Period(Hrs)','Freq'], axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "sun = make_index(sun)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Station</th>\n",
       "      <th>Date(NZST)</th>\n",
       "      <th>Time(NZST)</th>\n",
       "      <th>Amount(Hrs)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2012-01-01 00:00:00</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>0:00</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 01:00:00</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>1:00</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 02:00:00</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>2:00</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 03:00:00</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>3:00</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 04:00:00</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>4:00</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                   Station Date(NZST) Time(NZST)  Amount(Hrs)\n",
       "2012-01-01 00:00:00  Auckland, Mangere Ews  1/01/2012       0:00          0.0\n",
       "2012-01-01 01:00:00  Auckland, Mangere Ews  1/01/2012       1:00          0.0\n",
       "2012-01-01 02:00:00  Auckland, Mangere Ews  1/01/2012       2:00          0.0\n",
       "2012-01-01 03:00:00  Auckland, Mangere Ews  1/01/2012       3:00          0.0\n",
       "2012-01-01 04:00:00  Auckland, Mangere Ews  1/01/2012       4:00          0.0"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sun.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "sun_hourly_day = select_day(sun, resample=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "sun_hourly_day.to_csv('../data/weather/hourly/sun_hourly_daytime.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [],
   "source": [
    "rain = pd.read_csv('../data/weather/hourly/Mangere hourly rain.csv', dtype=dict_dtypes['rain'], na_values=['|-'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Station</th>\n",
       "      <th>Date(NZST)</th>\n",
       "      <th>Time(NZST)</th>\n",
       "      <th>Amount(mm)</th>\n",
       "      <th>Period(Hrs)</th>\n",
       "      <th>Freq</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>00:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>H</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>01:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>H</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>02:00</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1</td>\n",
       "      <td>H</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>03:00</td>\n",
       "      <td>0.1</td>\n",
       "      <td>1</td>\n",
       "      <td>H</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>04:00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1</td>\n",
       "      <td>H</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                 Station Date(NZST) Time(NZST)  Amount(mm)  Period(Hrs) Freq\n",
       "0  Auckland, Mangere Ews  1/01/2012      00:00         0.0            1    H\n",
       "1  Auckland, Mangere Ews  1/01/2012      01:00         0.0            1    H\n",
       "2  Auckland, Mangere Ews  1/01/2012      02:00         1.0            1    H\n",
       "3  Auckland, Mangere Ews  1/01/2012      03:00         0.1            1    H\n",
       "4  Auckland, Mangere Ews  1/01/2012      04:00         0.0            1    H"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rain.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [],
   "source": [
    "rain = rain.drop(['Period(Hrs)','Freq'], axis=1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [],
   "source": [
    "rain = make_index(rain)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Station</th>\n",
       "      <th>Date(NZST)</th>\n",
       "      <th>Time(NZST)</th>\n",
       "      <th>Amount(mm)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2012-01-01 00:00:00</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>00:00</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 01:00:00</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>01:00</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 02:00:00</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>02:00</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 03:00:00</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>03:00</td>\n",
       "      <td>0.1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2012-01-01 04:00:00</th>\n",
       "      <td>Auckland, Mangere Ews</td>\n",
       "      <td>1/01/2012</td>\n",
       "      <td>04:00</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                   Station Date(NZST) Time(NZST)  Amount(mm)\n",
       "2012-01-01 00:00:00  Auckland, Mangere Ews  1/01/2012      00:00         0.0\n",
       "2012-01-01 01:00:00  Auckland, Mangere Ews  1/01/2012      01:00         0.0\n",
       "2012-01-01 02:00:00  Auckland, Mangere Ews  1/01/2012      02:00         1.0\n",
       "2012-01-01 03:00:00  Auckland, Mangere Ews  1/01/2012      03:00         0.1\n",
       "2012-01-01 04:00:00  Auckland, Mangere Ews  1/01/2012      04:00         0.0"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "rain.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "rain_hourly_day = select_day(rain, resample=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [],
   "source": [
    "rain_hourly_day.to_csv('../data/weather/hourly/rain_hourly_daytime.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [],
   "source": [
    "wind = pd.read_csv('../data/weather/hourly/mangere_wind.csv', index_col=0, parse_dates=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Dir(DegT)</th>\n",
       "      <th>Speed(m/s)</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2011-01-01 00:00:00</th>\n",
       "      <td>220.0</td>\n",
       "      <td>6.6</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2011-01-01 01:00:00</th>\n",
       "      <td>220.0</td>\n",
       "      <td>7.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2011-01-01 02:00:00</th>\n",
       "      <td>218.0</td>\n",
       "      <td>7.4</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2011-01-01 03:00:00</th>\n",
       "      <td>221.0</td>\n",
       "      <td>5.8</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2011-01-01 04:00:00</th>\n",
       "      <td>224.0</td>\n",
       "      <td>7.4</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                     Dir(DegT)  Speed(m/s)\n",
       "2011-01-01 00:00:00      220.0         6.6\n",
       "2011-01-01 01:00:00      220.0         7.8\n",
       "2011-01-01 02:00:00      218.0         7.4\n",
       "2011-01-01 03:00:00      221.0         5.8\n",
       "2011-01-01 04:00:00      224.0         7.4"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "wind.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [],
   "source": [
    "wind_hourly_day = select_day(wind, resample=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [],
   "source": [
    "wind_hourly_day.to_csv('../data/weather/hourly/wind_hourly_daytime.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 143,
   "metadata": {},
   "outputs": [],
   "source": [
    "# rain_commute = select_commute(rain)\n",
    "# rain_day = select_day(rain)\n",
    "rain_morning = select_morning(rain)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 144,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x1292f7390>"
      ]
     },
     "execution_count": 144,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBOR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hg8fjmHDhmHnzp0AgLKyMowcORIXXXQRRo4cifLycgDAvffei2nTpsXW0adPn9hyv/jFL+KWW27B0KFDcccdd0BV8dRTT2Hv3r245pprcM011wAAJk+ejJtuugkAUFpaiqFDh2LMmDG48MILcccdd2DevHkYMWIEzj33XKxcuRIA8PDDD+Oee+7Bddddh4KCArz55pt48MEHMWzYMIwaNQotLS0AgKuvvhrz5s1Da2urJ9vUaidTRBRyj7yzCZv3ulstcP6Z/fCbr1xgOs1bb72FUaNGYfDgwTjllFOwevVqAMC6detQUlKCU045BWeffTbGjBmDlStX4sknn8Tf/vY3TJgwAffffz/uvvtu3HPPPXj++efxwAMP4K233jJd35o1a7Bp0yaceeaZGDFiBJYsWYIHHngAjz/+OBYsWID+/fsDAJYsWYJ//etfsfl27NiB119/HRMnTsRll12GKVOmYPHixZgxYwb++Mc/xta7c+dOLFiwAJs3b8YVV1yBN954A+PHj8fNN9+MmTNn4mtf+xry8vLwmc98BuvWrcOll17qZBOnxBI3EXlq6tSpGD26oyfo0aNHY+rUqQCAyy67DAMGDEDPnj1xzjnn4LrrrgMADBs2DKWlpQCAZcuW4fbbbwcA3HXXXVi8eHHa9Q0fPhwDBw5EXl4eLrnkktiykh08eBB9+/aN/T1o0CAMGzYMeXl5uOCCCzBy5EiISEI8AHD99dejR48eGDZsGNra2jBq1KhOcQPAaaedhr17TTtSzRhL3ERdRLqSsRdqamowf/58bNy4ESKCtrY2iAhuuOEG9OzZMzZdXl5e7O+8vDzDKoZoU7ru3bujvb0dQMdNxubm5tg08cvt1q2b4bKiy8jLy+s0n1k88e/36NEjFlPydE1NTejdu7fp9skUS9xE5Jlp06bh7rvvRllZGUpLS7F7924MGjTIUskZAK688spYvfjkyZNx1VVXAejoOrq4uBgA8Pbbb8fqls307dsX9fX1sb+HDBmCXbt22f1Klm3btg0XXODNyZKJm4g8M3XqVNx8880J733jG9/AlClTLM3/1FNP4YUXXsBFF12ESZMm4cknnwQA3Hffffjwww8xfPhwrFixAieddFLaZ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kccW58rcavqz1V1oKoWoOMSeL6qelYacXF7nyQifaOvAVwHYKP7EcfW59b23gdgt4gMibw1EsBml8ONcSvuOLfBp2oSF2MvB3C5iJwYWeZIdNSXB5+Xdz61407tVeioc1wPYG3k3w0ATgXwAYDtkf9PiUx/BjpKH3UADkde9zNaTgjivgjAmshyNgL4dRi2d9IyvwjvW5W4tb3PBrAu8m8TgF+GIe7IZ5cAKIos6y0AnwxJ3CcCqAHwCS+3tUexP4KOgtRGAJMA9PTjOzj9xycniYhChk9OEhGFDBM3EVHIMHETEYUMEzcRUcgwcRMRhQwTNxFRyDBxExGFDBM3EVHI/H8DHyDl3pGVcQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "rain_morning.plot()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 145,
   "metadata": {},
   "outputs": [],
   "source": [
    "# temp_commute = select_commute(temp)\n",
    "# temp_day = select_day(temp)\n",
    "temp_morning = select_morning(temp)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 146,
   "metadata": {},
   "outputs": [],
   "source": [
    "# sun_commute = select_commute(sun)\n",
    "# sun_day = select_day(sun)\n",
    "sun_morning = select_morning(sun)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 148,
   "metadata": {},
   "outputs": [],
   "source": [
    "# wind_commute = select_commute(wind)\n",
    "# wind_day = select_day(wind)\n",
    "wind_morning = select_morning(wind)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 149,
   "metadata": {},
   "outputs": [],
   "source": [
    "# sun_commute.to_csv('../data/weather/hourly/commute/sun_commute.csv')\n",
    "# sun_day.to_csv('../data/weather/hourly/commute/sun_day.csv')\n",
    "# sun_morning.to_csv('../data/weather/hourly/commute/sun_morning.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 150,
   "metadata": {},
   "outputs": [],
   "source": [
    "# rain_commute.to_csv('../data/weather/hourly/commute/rain_commute.csv')\n",
    "# rain_day.to_csv('../data/weather/hourly/commute/rain_day.csv')\n",
    "# rain_morning.to_csv('../data/weather/hourly/commute/rain_morning.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 151,
   "metadata": {},
   "outputs": [],
   "source": [
    "# temp_commute.to_csv('../data/weather/hourly/commute/temp_commute.csv')\n",
    "# temp_day.to_csv('../data/weather/hourly/commute/temp_day.csv')\n",
    "# temp_morning.to_csv('../data/weather/hourly/commute/temp_morning.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 152,
   "metadata": {},
   "outputs": [],
   "source": [
    "# wind_commute.to_csv('../data/weather/hourly/commute/wind_commute.csv')\n",
    "# wind_day.to_csv('../data/weather/hourly/commute/wind_day.csv')\n",
    "# wind_morning.to_csv('../data/weather/hourly/commute/wind_morning.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": false,
   "sideBar": false,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": false,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
